<?php $classGrade = $this->ClassGrade()?>
<style>
#countTable {border-spacing:0px;  width:100%; background: #dee; text-align:center}
#countTable tbody tr{background: #ffe}
.memo {color:#f00; font-size:12px}
.memo p {margin:3px;}
</style>
<table id="countTable" border="1">
<thead>
<tr>
<th colspan="<?php echo count($classGrade)*2+5?>"><?php echo $this->Semester['yearSemeName']?> 學生異動統計表</th>
</tr>
<tr>
<th rowspan="2">異動類別</th>
<th>年級</th>
<?php foreach($classGrade as $year=>$yearName):?>
<th colspan="2"><?php echo $yearName?></th>
<?php endforeach?>
<th colspan="2">小計</th>
</tr>
<tr>
<th>性別</th>
<?php foreach($classGrade as $year=>$yearName):?>
<th>男</th>
<th>女</th>
<?php endforeach;?>
<th>男</th>
<th>女</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><?php echo $this->arrayData['study_cond'][0]?></td>
<?php $val = $this->inRefisterData ?>
<?php foreach($classGrade as $year=>$yearName):?>
<td><?php if(isset($val[$year]['M'])):?><?php echo $val[$year]['M']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<td><?php if(isset($val[$year]['F'])):?><?php echo $val[$year]['F']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<?php endforeach;?>
<td><?php if (isset($val['count']['M'])):?> <?php echo $val['count']['M']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<td><?php if (isset($val['count']['F'])):?> <?php echo $val['count']['F']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
</tr>

<?php foreach($this->data as $kind=>$val):?>
<tr>
<td colspan="2"><?php echo $this->arrayData['study_cond'][$kind]?></td>
<?php foreach($classGrade as $year=>$yearName):?>
<td><?php if(isset($val[$year]['M'])):?><?php echo $val[$year]['M']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<td><?php if(isset($val[$year]['F'])):?><?php echo $val[$year]['F']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<?php endforeach?>
<td><?php if (isset($val['count']['M'])):?> <?php echo $val['count']['M']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
<td><?php if (isset($val['count']['F'])):?> <?php echo $val['count']['F']?>
<?php else:?><span style="color:#ccc">0</span><?php endif?></td>
</tr>
<?php endforeach?>

</tbody>
</table>
<div class="memo">
<p>※在籍含在家自學學生</p>
<p>※若總人數與各年級人數不符, 則表示有錯誤資料存在。</p>
</div>
